import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

// 使用常量替代 Mutation 事件类型
const CONST_COMMIT_CHANGE_BUFF = "CONST_COMMIT_CHANGE_BUFF";

export default new Vuex.Store({
  state: {
    userInof: {
      token: "登陆凭证",
      name: "鲁班七号"
    }
    // buff: "带蓝buff的"
  },
  getters: {},
  mutations: {
    [types.LOGIN]: (state, data) => {
      localStorage.token = data;
      sessionStorage.token = data;
      state.token = data;
    }
  },
  actions: {},
  modules: {}
});
